import {useNavigate,useLocation,useSearchParams,useParams} from 'react-router-dom'
const withRouter=(WrapperComponent)=>{
    return (props)=>{
        const navigate=useNavigate()
        const [query]=useSearchParams()
        const params=useParams()
        const {state}=useLocation()
        return <WrapperComponent
            navigate={navigate}
            query={query}
            params={params}
            state={state}
            {...props}></WrapperComponent>
    }
}
export default withRouter